import type { RouteRecordRedirectOption } from 'vue-router'
import type { TableRefType } from '@/types/components/tableTypes.js'

// 通用键值对
export interface IKeyValue {
  [key: string]: any
}
// 通用方法对象
export interface IMethods {
  // eslint-disable-next-line ts/no-unsafe-function-type
  [key: string]: Function
}
// 账号数据
export interface IAccount {
  Menu: IBaseMenu[]
  RoleMenuMap: null
  ButtonMenuRoleMap: IButtonMenuRoleMap[]
  RoleMap: IRoleMap[]
  CenterID: number
  GroupID: number
  MenuVue: IMenuVue[]
  Organizes: []
  Account: string
  Pwd: string
  PositionID: string | null
  Name: string
  CardNo: string | null
  NickName: string
  OrganizeID: number
  Email: string | null
  Sex: string
  EntryDate: string | null
  LeaveDate: string | null
  CreatedBy: string
  CreatedByName: string
  ModifiedBy: string
  ModifiedByName: string
  CreatedOn: string
  ModifyedOn: string
  WorkFlowInstanceID: string | null
  Status: number
  UserType: string | null
  UserAttr: string | null
  OrganizeName: string
  LeadUserCode: string | null
  Tel: string | null
  DepartmentMan: string | null
  DepartmentMan2: string | null
  CMOMan: string | null
  CenterMan: string | null
  Extend1: string
  Extend2: string
  Extend3: string
}
// 菜单信息
export interface IBaseMenu {
  MenuCode: string
  MenuName: string
  IsEnable: boolean
  IsAllVisible: false
  TargetFor: string | null
  Url: string
  ParentCode: string | null
  AppCode: string | null
  Ico: string
  CreatedBy: string
  CreatedByName: string
  ModifiedBy: string
  ModifiedByName: string
  CreatedOn: string
  ModifyedOn: string
  WorkFlowInstanceID: string
  Status: number
  OrganizeID: number
  ViewSort: number
  IsOpenWindow: boolean
  Remark1: string
  Remark2: string | null
}
// vue菜单信息
export interface IMenuVue extends IBaseMenu {
  Component: string
  Redirect: RouteRecordRedirectOption | null
  Name: string
  Hidden: boolean
  keepAlive: boolean
}
// 角色地图
export interface IRoleMap {
  Account: string
  Email: string | null
  Name: string
  RoleName: string
  ID: number
  RoleID: string
}
// 表格行
export interface ITableRow {
  [key: string]: any
}

// 表头行
export interface ITableCol {
  label: string
  prop: string
  propName: string | null
  width: string | number
  fix: 'left' | 'right' | undefined | null
  sortable: string | null
  active: string | null
  icon: string | null
  button: string | null
  component: string | null
  isEdit: boolean
  isMerge: boolean
  dicID: string
  isLook: boolean
  children: ITableCol[] | null
  routerName: boolean
  cellStyle: boolean
  prop2: string
  left: number
  treeNode: boolean
  align: 'left' | 'right' | 'center' | undefined
  render: string | null
  className: string | null
  extend1: string | null
  extend2: string | null
  extend3: string | null
  extend4: string | null
  extend5: string | null
  extend6: string | null
  ValidType: string | null
  pageSize: number
  formater: string | null
  formatter?: string
  DataType: string | null
  FixCount: number
  appWidth: string | null
  items: IFormSelectOption[] | null
  IsSelect: boolean
  name: string
  displayName: string
  size: number
  cellType: string | null | any
  ControlType: string | null
  DataSourceName: string | null
  DataSourceID: string | null
  Required: boolean | null
  Items: string | null
  IsVisibleApp: string | null
  visible: boolean
  Region: string | null
  // 暂时没有
  placeholder?: string
}

// 下拉选项
export interface IFormSelectOption {
  title?: number | string
  value: number | string
  label: number | string
  text?: number | string
  Werks: number | string
}

// 分页
export interface IPagination {
  page: number
  rows: number
  Count: number
}

// 角色对应菜单对应按钮地图
export interface IButtonMenuRoleMap {
  ID: number
  ButtonMenuMapID: number
  RoleID: string
  CreatedBy: string
  CreatedByName: string
  ModifiedBy: string
  ModifiedByName: string
  CreatedOn: string
  ModifyedOn: string
  WorkFlowInstanceID: string | null
  Status: number
  TempKey: string | null
  ViewSort: string | null
  MenuCode: string
  ButtonID: number
  ButtonCode: string
  ButtonName: string
  OnClick: string
  FormUrl: string | null
  MenuName: string
  Icon: string | null
  ButtonType: '' | 'primary' | 'danger' | 'success' | 'warning' | 'info' | 'default' | 'text'
  BtnName: string
  Methods: string
  Type: string | null
  signName: string | null
}
// 查询表单项
export interface IFormItem {
  type: string
  label: string
  width: string | null
  prop: string
  placeholder: string
  methods: string | null
  options: IFormSelectOption[] | null
  dicID: number
  icon: string | null
  multiple: false
  value: string | number | string[] | null
  queryType: IKeyValue[]
}
// 表格数据集
export interface ITableDataSet {
  tableDatas: ITableRow[]
  tableColumns: ITableCol[]
  ID: number
  formItems: IFormItem[]
  form: IForm
  tableRef: TableRefType | null
  loading: boolean
  count: number
}

// 表单数据
export interface IForm {
  page: number
  rows: number
  [key: string]: any
}
